2791778cfaad092386c7ae1f4519325a9eb7e9b0,clc/modules/simpleworkflow/src/main/java/com/eucalyptus/simpleworkflow/SimpleWorkflowService.java,SimpleWorkflowService,respondActivityTaskCanceled,#RespondActivityTaskCanceledRequest#,980
Before Change
final TaskToken token =
taskTokenManager.decryptTaskToken( accountFullName.getAccountNumber( ), request.getTaskToken( ) );
activityTasks.updateByExample(
ActivityTask.exampleWithUniqueName( accountFullName, token.getRunId( ), token.getScheduledEventId( ) ),
accountFullName,
token.getRunId( ) + "/" + token.getScheduledEventId( ),
new Function<ActivityTask, ActivityTask>() {
@Override
public ActivityTask apply( final ActivityTask activityTask ) {
if ( accessible.apply( activityTask ) ) {
final WorkflowExecution workflowExecution = activityTask.getWorkflowExecution( );
workflowExecution.addHistoryEvent( WorkflowHistoryEvent.create(
workflowExecution,
new ActivityTaskCanceledEventAttributes()
.withDetails( request.getDetails() )
.withLatestCancelRequestedEventId( activityTask.getCancelRequestedEventId() )
.withScheduledEventId( activityTask.getScheduledEventId() )
.withStartedEventId( activityTask.getStartedEventId() )
) );
if ( workflowExecution.getDecisionStatus( ) != Pending ) {
workflowExecution.addHistoryEvent( WorkflowHistoryEvent.create(
workflowExecution,
new DecisionTaskScheduledEventAttributes( )
.withTaskList( new TaskList( ).withName( workflowExecution.getTaskList( ) ) )
.withStartToCloseTimeout( String.valueOf( workflowExecution.getTaskStartToCloseTimeout( ) ) )
) );
workflowExecution.setDecisionStatus( Pending );
workflowExecution.setDecisionTimestamp( new Date( ) );
}
Entities.delete( activityTask );
}
return activityTask;
}
} );
} catch ( SwfMetadataNotFoundException e ) {
throw new SimpleWorkflowClientException(
"UnknownResourceFault",
After Change
final TaskToken token =
taskTokenManager.decryptTaskToken( accountFullName.getAccountNumber( ), request.getTaskToken( ) );
final Pair<String,String> domainTaskListPair = activityTasks.updateByExample(
ActivityTask.exampleWithUniqueName( accountFullName, token.getRunId( ), token.getScheduledEventId( ) ),
accountFullName,
token.getRunId( ) + "/" + token.getScheduledEventId( ),
new Function<ActivityTask, Pair<String,String>>() {
@Override
public Pair<String,String> apply( final ActivityTask activityTask ) {
if ( accessible.apply( activityTask ) ) {
final WorkflowExecution workflowExecution = activityTask.getWorkflowExecution( );
workflowExecution.addHistoryEvent( WorkflowHistoryEvent.create(
workflowExecution,
new ActivityTaskCanceledEventAttributes()
.withDetails( request.getDetails() )
.withLatestCancelRequestedEventId( activityTask.getCancelRequestedEventId() )
.withScheduledEventId( activityTask.getScheduledEventId() )
.withStartedEventId( activityTask.getStartedEventId() )
) );
if ( workflowExecution.getDecisionStatus( ) != Pending ) {
workflowExecution.addHistoryEvent( WorkflowHistoryEvent.create(
workflowExecution,
new DecisionTaskScheduledEventAttributes( )
.withTaskList( new TaskList( ).withName( workflowExecution.getTaskList( ) ) )
.withStartToCloseTimeout( String.valueOf( workflowExecution.getTaskStartToCloseTimeout( ) ) )
) );
workflowExecution.setDecisionStatus( Pending );
workflowExecution.setDecisionTimestamp( new Date( ) );
}
Entities.delete( activityTask );
return Pair.pair( workflowExecution.getDomainName( ), workflowExecution.getTaskList( ) );
}
return null;
}
} );
if ( domainTaskListPair != null ) {
notifyTaskList( accountFullName, domainTaskListPair.getLeft(), "decision", domainTaskListPair.getRight() );
}
} catch ( SwfMetadataNotFoundException e ) {
throw new SimpleWorkflowClientException(